/**
 *    Copyright 2009-2015 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.apache.ibatis.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.apache.ibatis.mapping.StatementType;

/**
 * 为了解决Insert数据时不支持主键自动生成的问题,他可以很随意的设置生成主键的方式
 * @author Clinton Begin
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SelectKey {
	/**
	 * 要执行的sql语句的字符串数组
	 * @return
	 */
  String[] statement();
  /**
   * 是需要更新为新值的参数对象属性
   * @return
   */
  String keyProperty();
  /**
   * key列
   * @return
   */
  String keyColumn() default "";
  /**
   * 可以是true或者false分别代表sql语句应该在执行insert之前或者之后
   * @return
   */
  boolean before();
  /**
   * keyProperty的Java类型
   * @return
   */
  Class<?> resultType();
  /**
   * 语句类型
   * @return
   */
  StatementType statementType() default StatementType.PREPARED;
}
